using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class PPOrderEntryMap : EntityTypeConfiguration<PPOrderEntry>
    {
        public PPOrderEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FInterID, t.FEntryID });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FNote)
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("PPOrderEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FItemID).HasColumnName("FItemID");
            this.Property(t => t.FUnitID).HasColumnName("FUnitID");
            this.Property(t => t.FQty).HasColumnName("FQty");
            this.Property(t => t.FNeedDate).HasColumnName("FNeedDate");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FAuxQty).HasColumnName("FAuxQty");
            this.Property(t => t.FCommitQty).HasColumnName("FCommitQty");
            this.Property(t => t.FAuxCommitQty).HasColumnName("FAuxCommitQty");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FHaveMrp).HasColumnName("FHaveMrp");
            this.Property(t => t.FMrpClosed).HasColumnName("FMrpClosed");
            this.Property(t => t.FNeedDateEnd).HasColumnName("FNeedDateEnd");
            this.Property(t => t.FSplitCycleID).HasColumnName("FSplitCycleID");
            this.Property(t => t.FOrgNeedDate).HasColumnName("FOrgNeedDate");
            this.Property(t => t.FOrgNeedDateEnd).HasColumnName("FOrgNeedDateEnd");
            this.Property(t => t.FOrgEntryID).HasColumnName("FOrgEntryID");
            this.Property(t => t.FIsKilled).HasColumnName("FIsKilled");
            this.Property(t => t.FKillQty).HasColumnName("FKillQty");
            this.Property(t => t.FAuxKillQty).HasColumnName("FAuxKillQty");
            this.Property(t => t.FBomInterID).HasColumnName("FBomInterID");
            this.Property(t => t.FCustID).HasColumnName("FCustID");
            this.Property(t => t.FSaleQty).HasColumnName("FSaleQty");
            this.Property(t => t.FAuxSaleQty).HasColumnName("FAuxSaleQty");
            this.Property(t => t.FSelQty).HasColumnName("FSelQty");
            this.Property(t => t.FAuxSelQty).HasColumnName("FAuxSelQty");
            this.Property(t => t.FOrderClosed).HasColumnName("FOrderClosed");
            this.Property(t => t.FMRPLockFlag).HasColumnName("FMRPLockFlag");
        }
    }
}
